﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TireService.Data
{
    public class InvoiceDetailBLL
    {
        // OUTDATED: 2012-10-28, not used anymore - taken over by E-conomic
        //public void UpdateInvoiceDetailWithCustomerSubscription(TireServiceDB db, Invoice invoice, InvoiceDetail invoicedetail, CustomerSubscription customersubscription, int InvoiceDetailId, string Description, decimal Price, bool SubmitInTransaction)
        //{          
        //    try
        //    {
        //        // Create/Update existing invoicedetail
        //        customersubscription.InvoiceDetails.Add(invoicedetail);
        //        invoicedetail.SubscriptionId = customersubscription.SubscriptionId;
        //        invoice.InvoiceDetails.Add(invoicedetail);
        //        invoicedetail.Description = Description;
        //        invoicedetail.Price = Price;
                
        //        // Create new invoicedetail
        //        if (InvoiceDetailId == 0)
        //        {
        //            db.AddInvoiceDetail(invoicedetail);
        //        }

        //        // Check if invoicedetail is being created/updated in other transaction
        //        if (!SubmitInTransaction)
        //        {
        //            // Submit changes to database
        //            db.SubmitChanges();
        //        }
        //    }
        //    catch (Exception ex)
        //    {


        //    }
        //}

        // OUTDATED: 2012-10-28, not used anymore - taken over by E-conomic
        //public void UpdateInvoiceDetailNoCustomerSubscription(TireServiceDB db, Invoice invoice, InvoiceDetail invoicedetail, int InvoiceDetailId, string Description, decimal Price, bool SubmitInTransaction)
        //{
        //    try
        //    {
        //        // Create/Update existing invoicedetail
        //        invoice.InvoiceDetails.Add(invoicedetail);
        //        invoicedetail.Description = Description;
        //        invoicedetail.Price = Price;

        //        // Create new invoicedetail
        //        if (InvoiceDetailId == 0)
        //        {
        //            db.AddInvoiceDetail(invoicedetail);
        //        }

        //        // Check if invoicedetail is being created/updated in other transaction
        //        if (!SubmitInTransaction)
        //        {
        //            // Submit changes to database
        //            db.SubmitChanges();
        //        }
        //    }
        //    catch (Exception ex)
        //    {

        //    }
        //}
    }
}
